import { ApiCall } from "tsrpc";
import { player } from "../../../model/fight/body/player";
import { ReqList_filter, ResList_filter } from "../../../shared/master/bag/PtlList_filter";
import { prop_equip } from "../../../model/bag/prop_equip";

export default async function (call: ApiCall<ReqList_filter, ResList_filter>) {
    let user = call.req._player as player;
    user.refBagLastFilter(call.req.filter);
    let bagArry: any[] = user.getBagList();
    let resArry: any[] = [];
    for (let index = 0; index < bagArry.length; index++) {
        const element = bagArry[index];
        if (!element) {
            resArry.push(undefined);
        } else {
            resArry.push({ name: element.getStyleName(), type: element.min_type, cont: element.num, icon: element.icon })
        }
    }
    call.succ({ list: resArry })
}